package com.example.xiaomi.controller;

import com.example.xiaomi.entity.wordfreq;
import com.example.xiaomi.service.WordfreqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("freq")
@CrossOrigin
public class WordfreqController {
        @Autowired
        private WordfreqService service;

        /**
         * http://localhost:8080/freq/list #输入词频所有的信息
         * @return
         */
        @GetMapping("/list")
        public List<wordfreq> getAllfreq(){
            List<wordfreq> FreqList = service.findAllfreq();
            return FreqList;
        }

    /**
     * http://localhost:8080/freq/list1 #输入词频>20
     * @return
     */
        @GetMapping("/list1")
        public List<wordfreq> getfreq1(){
            List<wordfreq> info=service.findfreq1();
            return info;
        }
    /**
     * http://localhost:8080/freq/list2 #输出最新一天的词频,七个热门词语
     * @return
     */
    @GetMapping("/list2")
    public List<wordfreq> getfreq2(){
        List<wordfreq> info=service.findfreq2();
        return info;
    }
}
